<template>
	<view class="user">
		<view class="top">
			<image src="../../static/logo.png" mode=""></image>
			<view class="text">浏览历史</view>
		</view>
		<view class="content">
			<view class="row" v-for="item in hisList">
				<newsbox :item="item" @click.native="godetail(item)"></newsbox>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				hisList:[],
			};
		},
		onShow() {
			this.getData()
		},
		methods:{
			//跳转详情页
			godetail(item){
				uni.navigateTo({
					url:`/pages/detail/detail?cid=${item.classid}&id=${item.id}`
				})
			},
			//获取缓存中的浏览记录
			getData(){
				let hisList = uni.getStorageSync("historyList") || []
				console.log(hisList)
				this.hisList = hisList
			}
		}
	}
</script>

<style lang="scss">
.user{
	.top{
		padding: 50rpx 0;
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
		image{
			height: 200rpx;
			width: 200rpx;
		}
		.text{
			font-size: 50rpx;
			padding-top: 20rpx;
		}
	}
	.content{
		padding: 30rpx;
		.row{
			border-bottom: 2px dashed #efefef;
			padding: 20rpx 0;
		}
	}
}
</style>
